<script src="../addons/tim_welfare/template/mobile/js/jquery-1.9.1.min.js" type="text/javascript"></script>
<script src="../addons/tim_welfare/template/mobile/js/layer_pc/layer.js" type="text/javascript"></script>
{template 'common/header'}
<div class='container' style='padding:0 5px 10px;margin:0;width:100%'>
	<ul class="nav nav-tabs">
	  	<li {if $op == 'display'}class="active"{/if}><a href="{php echo $this->createWebUrl('message',array('op'=>'display'));}">留言列表</a></li>
		{if $op =='message'}
		<li class="active"><a href="javascript:;">留言列表</a></li>
		{/if}
	</ul>	
	{if $op =='display'}
	<div class="panel panel-success">
        <div class="panel-heading">常用工具 > 留言列表</div>
		<div class="panel-body">
			<form role="form" class="form-horizontal" method="get" action="./index.php">
				<input type="hidden" name="c" value="site" />
				<input type="hidden" name="a" value="entry" />
				<input type="hidden" name="m" value="tim_welfare" />
				<input type="hidden" name="do" value="message" />
				<div class="form-group">
					<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">审核状态</label>
					<div class="col-sm-8">
						<select name="states" id="state" class="form-control">
							<option value="0" {if $state == 0 } selected="selected" {/if}>未审核</option>
							<option value="1" {if $state == 1 } selected="selected" {/if}>已审核</option>
					   </select>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">归属项目</label>
					<div class="col-sm-8">
						<select name="pro_id" id="pro_id" class="form-control">
							<option value="0">全部</option>
							{loop $pro $row}
							<option value="{$row['pro_id']}" <?php if($pro_id == $row['pro_id']){echo 'selected="selected"';}?> >{$row['pro_name']}</option>
							{/loop}
					   </select>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">微信昵称</label>
					<div class="col-sm-8">
						<input type="text" class="form-control" id="mem_name" name="mem_name" value="{$mem_name}">
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label"></label>
					<div class="col-sm-4">
					   <input id="search" type="submit" value="搜索" class="btn btn-primary span3" /> 
					</div>
				</div>
			</form>
		</div>
	</div>
	<div class="main">
		<form id="form2" class="form-horizontal" action="{php echo $this->createWebUrl('message', array('op' => 'del'));}" method="post" >
			<table class="table table-hover">
				<thead class="navbar-inner">
					<tr>
						<th style="width:30px">全选</th>
						<th style="text-align:center;width:70px;">昵称</th>						
	          			<th style="text-align:center;width:120px;">归属项目</th>
	          			<th style="text-align:center;width:300px;">留言</th>
	          			<th style="text-align:center;width:120px;">发布时间</th>
						<th style="text-align:center;min-width:80px;width:80px;">操作</th>
					</tr>
				</thead>
				<tbody>
					{loop $list $item}
					<tr>
						<td>
							<input type="checkbox" value="{$item['comment_id']}" name="delete[]">
						</td>
						<td style="text-align:center;"><?php if(empty($item['mem_name'])){echo '管理员';}else{echo $item['mem_name'];}?></td>
						<td style="text-align:center;cursor:pointer;" id="{$item['comment_id']}1" onmouseover="ckxq('{$item['pro_name']}','{$item['comment_id']}1');">{php echo mb_substr($item['pro_name'],0,10);}</td>   
						<td style="text-align:center;width:300px;cursor:pointer;" id="{$item['comment_id']}2" onmouseover="ckxq('{$item['comment_cont']}','{$item['comment_id']}2');">{php echo mb_substr($item['comment_cont'],0,10)}</td>	
						<td style="text-align:center;">{php echo date('Y-m-d H:i:s',$item['time']);}</td>						
						<td style="text-align:center;">
							<?php if(empty($item['parent_id'])){ ?>
							<a href="{php echo $this->createWebUrl('message',array('op'=>'message','comment_id' =>$item['comment_id'],'pro_id'=> $item['pro_id']));}" title="留言" class="btn btn-xs btn-primary"><span class="icon icon-compose">留言</span></a>
							<?php } ?>
							<a href="{php echo $this->createWebUrl('message', array('comment_id' => $item['comment_id'],'op'=>'ok'))}" title="审核" class="btn btn-xs btn-primary"><span class="icon icon-compose">审核</span></a>
							<a onclick="if(confirm('此操作不可恢复，确认吗？')){location.href='{php echo $this->createWebUrl('message', array('comment_id' => $item['comment_id'],'op'=>'del'))}'}" href="javascript:;" title="删除" class="btn btn-xs btn-danger"><span class="icon icon-close">删除</span></a>
						</td>				
					</tr>
					{/loop}
					<tr>
						<td>
							<input type="checkbox"  onclick="var ck = this.checked;$(':checkbox').each(function(){this.checked = ck});" name=''>
							<input class="btn btn-primary" type="submit" value="删除" name="submit" onclick="return confirm('此操作不可恢复，确认吗？'); return false;" >
						</td>
						<td></td><td></td><td></td><td></td><td></td><td></td>
					</tr>
				</tbody>
			</table>
			<input type="hidden" name="token" value="{$_W['token']}" />
		</form>	
		{$pager}
		<script>	
			function ckxq (content,mem_id){		
				layer.tips(content, '#'+mem_id, {
				  tips: [1, '#3595CC'],
				  time: 3000
				});
			}			
		</script>	
	</div>
{elseif $op =='message' }
	<div class="panel panel-success">
        <div class="panel-heading">常用工具 > 添加留言</div>
		<div class="panel-body">
			<form class="form-horizontal" method="post" action="{php echo $this->createWebUrl('message',array('op'=>'message','flag'=>'add'));}">				
				<div class="form-group">
					<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">留言</label>
					<div class="col-sm-8">
						<textarea name="comment_cont" rows="3" cols="20" style="width:580px;height:150px;" class="form-control"></textarea>
					</div>
				</div>
				<input type="hidden" name="comment_id" value="{$comment_id}">
				<input type="hidden" name="pro_id" value="{$pro_id}">
				<div class="form-group">
					<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label"></label>
					<div class="col-sm-4">
					   <input name="submit" type="submit" value="提交" class="btn btn-primary span3" /> 
					</div>
				</div>
			</form>
		</div>
	</div>	
{/if}		
</div>
{template 'common/footer'}


